ActionController::Routing::Routes.draw do |map|

  map.namespace :admin do |admin|
    admin.resources :posts
    admin.resources :categories
    admin.resources :user_level_rules
  end

  map.connect '/asset/:id', :controller => 'user_assets', :action => 'show'
  map.connect '/images/:user_name/:filename.:ext', :controller => 'user_assets', :action => 'image'
  map.connect '/test/upload', :controller => 'user_assets', :action => 'upload_tester'
  map.connect '/test/upload/create', :controller => 'user_assets', :action => 'create'
  map.resource :session

  map.denied '/denied/', :controller => 'common', :action => 'index'

  map.rules_index 'admin/rules/', :controller => 'admin/user_level_rules', :action => 'index'
  map.new_rule 'admin/rules/new', :controller => 'admin/user_level_rules', :action => 'new'

  map.admin 'admin/', :controller=>'admin/posts', :action=>'index'
  map.connect 'admin/show_post_body/:id', :controller => 'admin/posts', :action => 'show_post_body'
  map.admin_delete_post 'admin/delete/:id', :controller=>'admin/posts', :action=>'destroy'

  map.category_control_panel 'admin/categories/', :controller=>'admin/categories', :action=>'index'
  map.new_category 'admin/cat/new/', :controller => 'admin/categories', :action =>'new'
  map.create_category 'admin/cat/create/', :controller => 'admin/categories', :action =>'create'
  map.edit_category 'admin/cat/edit/:id', :controller=>'admin/categories', :action=>'edit'
  map.delete_category 'admin/cat/delete/:id', :controller=>'admin/categories', :action=>'destroy'


  map.connect '/posts/show_post_body/:id', :controller => 'posts', :action => 'show_post_body'
	map.post_denied '/posts/:id/denied', :controller=>'posts', :action=>'denied'
	map.new_post '/posts/new/:cat', :controller=>'posts', :action=>'new'
	map.new_reply '/posts/reply/:parent_id', :controller=>'posts', :action=>'reply'
	map.connect '/posts/create', :controller=>'posts', :action=>'create'
	map.connect '/posts/', :controller=>'posts', :action=>'index'
	map.edit_post '/posts/edit/:id', :controller=>'posts', :action=>'edit'
	map.connect '/posts/update/:id', :controller=>'posts', :action=>'update'
	map.delete_post '/posts/delete/:id', :controller=>'posts',:action=>'destroy'
	map.show_post '/posts/:id', :controller=>'posts', :action=>'show'

	map.all_users '/users/', :controller=>'users', :action=>'index'
	map.toggle_admin '/users/:id/toggle_admin', :controller=>'users', :action=>'toggle_admin'
  map.new_user '/users/new', :controller=>'users', :action=>'new'
  map.connect '/users/create', :controller=>'users', :action=>'create'
  map.show_users_posts '/users/posts/:id', :controller=>'users', :action=>'show_users_posts'
  map.show_user '/users/:id', :controller=>'users', :action=>'show'
  map.edit_user '/users/:id/edit', :controller=>'users', :action=>'edit'
  map.connect '/users/:id/update', :controller=>'users', :action=>'update'
  map.delete_user '/users/:id/delete', :controller=>'users', :action=>'destroy'

  map.vote '/votes/:id/:v', :controller => 'votes', :action => 'vote'

  map.home '/', :controller=>'categories', :action=>'index'
  map.show_category_posts '/cat/:id', :controller=>'categories', :action=>'show_category_posts'
  
end